package com.dididoctor.doctor.Dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.dididoctor.doctor.Activity.Usercentre.MyPurse.ChoicePayWay.PayWayView;
import com.dididoctor.doctor.Activity.Usercentre.MyPurse.CollectionMethods.BankBean;
import com.dididoctor.doctor.MV.BaseDialog;
import com.dididoctor.doctor.R;
import com.dididoctor.doctor.Utils.Util;


public class ChoiceConfirmDialog extends BaseDialog {
    private TextView mTvConfirm, mTvCancel, mTvName, mTvBankType, mTvCard, mTvNum;
    private Context context;
    private BankBean bean;
    private String num;

    public ChoiceConfirmDialog(Context context, BankBean bean, String num) {
        super(context);
        this.context = context;
        this.bean = bean;
        this.num = num;
        setContentView(R.layout.dialog_choicecard);
        mTvConfirm = (TextView) findViewById(R.id.tv_confirm);
        mTvConfirm.setOnClickListener(this);
        mTvCancel = (TextView) findViewById(R.id.tv_cancel);
        mTvCancel.setOnClickListener(this);
        mTvName = (TextView) findViewById(R.id.tv_name);
        mTvBankType = (TextView) findViewById(R.id.tv_type);
        mTvCard = (TextView) findViewById(R.id.tv_card);
        mTvNum = (TextView) findViewById(R.id.tv_num);

        String name = bean.getDocName();
        if (!Util.isEmpty(name)) {
            mTvName.setText("持卡人姓名:" + name);
        }

        String type = bean.getBankName();
        if (!Util.isEmpty(name)) {
            mTvBankType.setText("收款银行:" + type);
        }

        String card = bean.getBankId();
        if (!Util.isEmpty(card)) {
            mTvCard.setText("收款账号:" + card);
        }

        mTvNum.setText("提现金额:¥" + num);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_confirm:
                ((PayWayView) context).Withdrawals(bean, num);
                break;
            case R.id.tv_cancel:
                dismiss();
                break;
            default:
                break;
        }
        super.onClick(v);
    }

}
